package com.eastfair.builder.controller;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.echo.core.EchoService;
import com.eastfair.venuebooking.api.WorkOvertimeConfigFeign;
import com.eastfair.venueservice.vo.WorkOvertimeConfigVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * <p>
 * 前端控制器
 * 加班规则配置
 * </p>
 *
 * @author dq
 * @date 2022-10-19
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/workOvertimeConfig")
public class WorkOvertimeConfigController {

    @Resource
    private EchoService echoService;

    @Resource
    private WorkOvertimeConfigFeign workOvertimeConfigFeign;

    /**
     * 展会ID查询加班规则配置VO.
     *
     * @param exhibitionManageId the exhibition manage id
     * @return the by exhibition manage id
     */
    @ApiOperation("展会ID查询加班规则配置VO")
    @GetMapping("/get/exhibition/{exhibitionManageId}")
    public R<WorkOvertimeConfigVO> getByExhibitionManageId(@PathVariable("exhibitionManageId") Long exhibitionManageId) {
        log.info("getByExhibitionManageId - 展会ID查询加班规则配置VO, exhibitionManageId={}", exhibitionManageId);
        try {
            return workOvertimeConfigFeign.getByExhibitionManageId(exhibitionManageId);
        } catch (BizException e) {
            return R.fail(e);
        }
    }

}
